package com.springboot.framework.dao.mapper;

import com.springboot.framework.dao.entity.Order;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface OrderMapper extends Mapper<Order> {

    @Select({"(select * from order_master where shop_id = #{shopId} and order_status = 0 GROUP BY id desc) " +
            "UNION all " +
            "(select * from order_master where shop_id = #{shopId} and order_status > 0 GROUP BY id desc)"})
    List<Order> selectAndSortAndGroup(@Param("shopId") Integer shopId);
}